package com.tanhua.server.controller;
import com.tanhua.model.vo.PeachblossomVo;
import com.tanhua.server.serivce.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;


@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {
    @Autowired
    private PeachblossomService peachblossomService;
    //桃花传音,上传语音
    @PostMapping
    public ResponseEntity peachblossom(MultipartFile soundFile) throws IOException {
        //调用service上传语音
        peachblossomService.savePeachblossom(soundFile);
        return  ResponseEntity.ok(null);
    }
    //桃花传音,语音接收语音
    @GetMapping
    public ResponseEntity peachblossom(){
        //调用servicec查询语音vo对象
        PeachblossomVo vo=peachblossomService.findPeachblossom();
        return  ResponseEntity.ok(vo);
    }
}
